package com.binguo.wxapi.controller;

import com.binguo.model.api.vo.OrderVO;
import com.binguo.service.OrderService;
import com.binguo.wxapi.result.Result;
import com.binguo.wxapi.result.ResultGenerator;
import com.qiniu.util.Auth;
import com.qiniu.util.StringMap;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Optional;

import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;


/**
 * Created by haibang on 18/5/7.
 */
@Api(tags = "小程序: 七牛token")
@RestController
@RequestMapping
public class WXTokenController {

    private static Logger logger = LoggerFactory.getLogger(WXTokenController.class);


    static String AccessKey = "2v6frbFEfnfI5xHe5sBP_O6ZDnwDbSiu_zYa_zfF";
    static String SecretKey = "ypc84sVpvQxB98CAsFqH-pK_qkMtot5dwWPFe1Z_";



    @GetMapping(value = "/api/wxapp/qiniu/token", produces = APPLICATION_JSON_VALUE)
    @ApiOperation(value = "获取七牛上传token")
    public Result getQiniuToken() {
        Auth auth = Auth.create(AccessKey, SecretKey);
        String token = auth.uploadToken("yunpeng");
        return ResultGenerator.genSuccessResult(token);
    }






}
